<template>
  <div>
    <el-table
      :data="tableData"
      border
      stripe
      style="width: 100%">
      <el-table-column
        prop="id"
        label="Id"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="电话"
        width="180">
      </el-table-column>
      <el-table-column
        prop="email"
        label="邮箱"
        width="180">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="创建时间"
        width="180">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址">
      </el-table-column>
    </el-table>
    <!--el-pagination：elementUI提供的分页组件
         background：带背景色
         layout：布局
         total：分页总条数
         align：位置
   -->
    <el-pagination
      background
      layout="sizes, prev, pager, next"
      align="right"
      :total="1000"
      :current-page="currentPage"
      :page-size="pageSize"
      :page-sizes="[5, 10, 15, 20]">
    </el-pagination>
  </div>
</template>

<script>
// 引入axios
// import axios from "axios";

 export default {
  name: 'user',
  data () {
    return {
      tableData: [],
      currentPage:5,
      pageSize:8,
       /*
      * this.$http.post("/user/pageData",{"currentpage":this.currentpage,
      *   "pageSize":this.pageSize})
      *   .then(result=>{
      *     this.tableData = result.data;
      * })
      * */
     }
   },
   mounted() {
    this.$http.post("/user/list", {"currentPage":1,"pageSize":5}).then(result => {
       console.log("======axios=====")
       this.tableData = result.data.data;
       console.log("======axios=====");
     }).catch(error =>{
      console.log(result)
     })
   }
 }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
